/*
 * OUnit - an OPAQUE compliant framework for Computer Aided Testing
 *
 * Copyright (C) 2010, 2011  Antti Andreimann
 *
 * This file is part of OUnit.
 *
 * OUnit is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * OUnit is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with OUnit.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.apache.wicket.extensions.protocol.opaque;

import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.request.mapper.parameter.PageParameters;

public class MockHomePage extends MockBasePage {
	private final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(this.getClass());
	private static final long serialVersionUID = 1L;

	public MockHomePage(PageParameters parameters) {
		super(parameters);
		log.debug("MockHomePage()");
		
		setVersioned(false);

		mainForm.add(new TextField<Integer>("nr"));
		mainForm.add(new Button("go") {
			private static final long serialVersionUID = 1L;
			@Override
			public void onSubmit() {
				log.debug("Go clicked");

				if(m.getNr() == -1)
				    setResponsePage(MockSecondPage.class);
				else
					setResponsePage(MockHomePage.class);
			}
		});
	}
}
